/*
 * CodeVerify.h
 *
 *  Created on: 2011-8-1
 *      Author: gexiao
 */
/*
 * Dalvik bytecode verifier.
 */
#ifndef CODEVERIFY_H_
#define CODEVERIFY_H_

/*
 * InsnFlags is a 32-bit integer with the following layout:
 *  0-15 instruction length (or 0 if this address doesn't hold an opcode)
 *  16   opcode flag (indicating this address holds an opcode)
 *  17   try block (indicating exceptions thrown here may be caught locally)
 *  30   visited (verifier has examined this instruction at least once)
 *  31   changed (set/cleared as bytecode verifier runs)
 */
typedef u4 InsnFlags;

/*
 * Table that maps uninitialized instances to classes, based on the
 * address of the new-instance instruction.
 */
typedef struct UninitInstanceMap {
	int numEntries;
	struct {
		int addr;//code offset, or -1 for method arg("this")
		ClassObject* clazz;//class created at this address
	} map[1];
} UninitInstanceMap;

/*
 * Create a new UninitInstanceMap.
 */
UninitInstanceMap* dvmCreateUninitInstanceMap(const Method* meth,
		const InsnFlags* insnFlags,int newInstanceCount);

/*
 * Release the storage associated with an UninitInstanceMap.
 */
void dvmFreeUninitInstanceMap(UninitInstanceMap* uninitMap);
#endif /* CODEVERIFY_H_ */
